<?
include "server_config.php";
?>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <title> 넥도닥 [NextDoorDoctor] :: 멘토-멘티 </title>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<style>
a:link {text-decoration:none} 
a:visited {text-decoration:none} 
a:active {text-decoration:none} 
a:hover {color:blue;text-decoration:none} 
</style>

 </head>

 <body style="line-height: 160%; font-size: 12px; font-family: '굴림'; padding: 0px; margin: 0px;  ">
  <table border=0 width='1000px' align='center'>
	

<?
include "nddg_top_menu.php";
?>	

	<tr>
		<td>
			<div style='width:270px;float:left;'>
				[미해결질문 목록]<br><br>
				<?
					$sql_sub="
						SELECT id, content, view_count, answer_count FROM nddg_question ORDER BY reg_timestamp LIMIT 5;
					";

					$result_sub = mysql_query($sql_sub,$connect);

					while($row_sub = mysql_fetch_row($result_sub))
					{

				?>
					<a href='nddg_db_category.php?question=<?=$row_sub[0]?>'><?=$row_sub[1]?></a><br>
					<?
					}
				?>
				<br>
				<br>

				[추천 글]<br><br>
				<?
					$sql="
						SELECT id, title FROM nddg_article ORDER BY reg_timestamp DESC ;
					";

					$result = mysql_query($sql,$connect);

					while($row = mysql_fetch_row($result))
					{
						$article_id = $row[0];
						$article_title = $row[1];
				?>	
					<a href='nddg_mento_view.php?article_id=<?=$article_id?>'><?=$article_title?></a><br>
					
				<?
					}
				?>

			</div>
			<div style='width:30px;float:left;height:50px;'>
			</div>
			<div style='width:700px;float:left;'>
				<b>[<a href='nddg_db_main.php'>데이터베이스</a> 최신글]</b><br>
				<br>
					<?
						$sql_sub="
							SELECT id, content, view_count, answer_count FROM nddg_question ORDER BY view_count DESC LIMIT 2 ;
						";

						$result_sub = mysql_query($sql_sub,$connect);

						while($row_sub = mysql_fetch_row($result_sub))
						{

					?>
						<b><?=$row_sub[1]?></b><br>

							<?
								$sql_answer="
									SELECT id, content, user_id FROM nddg_answer WHERE question_id=".$row_sub[0]."  LIMIT 1 ;
								";

								$result_answer = mysql_query($sql_answer,$connect);

								$row_answer = mysql_fetch_row($result_answer);

								echo utf8_strcut($row_answer[1],200);							

							?>
							<br>
							<a href='nddg_db_category.php?question=<?=$row_sub[0]?>'>
								- 전체보기 (3개의 답이 더 있습니다.)
							</a>
						
						<br>
						<br>
					<?
						}
					?>
				
				<br>
				<b>[<a href='nddg_mento_main.php'>멘토-멘티</a> 최신글]</b><br>
				<br>
				<?
					$sql="
						SELECT id, title_img_src, title, content FROM nddg_article ORDER BY reg_timestamp DESC LIMIT 2 ;
					";

					$result = mysql_query($sql,$connect);

					while($row = mysql_fetch_row($result))
					{
						$article_id = $row[0];
						$article_title_img_src = $row[1];
						$article_title = $row[2];
						$article_content = $row[3];
				?>
					<div style='width:700px;float:left;'>
						<a href='nddg_mento_view.php?article_id=<?=$article_id?>'>
							<img src='img/<?=$article_title_img_src?>' align='left' border='0' width='150px'/>
							<b><?=$article_title?></b><br>
							<br>
							<?=utf8_strcut($article_content,300);?><br>
							<br>
						</a>
					</div>
					<div style='width:700px;float:left;height:10px;'>
					</div>

				<?
					}
				?>
				
			</div>




			
		</td>
	</tr>

<?
include "nddg_footer.php";
?>	

  </table>
 </body>
</html>
